#ifndef __YMODEM_H__
#define __YMODEM_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef struct 
{
    /* int -1发送失败，>0 接收字节数，data 数据buff , len 接收数据长度 , 超时时间 ms */
    int (*get_data)(char* data,unsigned int len,unsigned int mstime);
    /* int -1发送失败，>0 发送字节数，data 数据buff , len 发送数据长度 , 超时时间 ms */
    int (*put_data)(char* data,unsigned int len,unsigned int mstime);
}ymodem_st;

extern int ymodem_register(int (*put_data)(char* data,unsigned int len,unsigned int mstime),
                            int (*get_data)(char* data,unsigned int len,unsigned int mstime));
extern int ymodem_recv(char *buff, long bufsize, char *filename);
extern int ymodem_send(char *buff, long bufsize, const char *filename);

#ifdef __cplusplus
}
#endif
#endif  /* __YMODEM_PORT_H__ */
